import React, {Component} from 'react';
import {Button, Card, Form, Input} from "antd";

class TableSearch extends Component {
  render() {
    return (
      <Card>
        <Form
          name="basic"
          layout="inline"
          labelCol={{ span: 8 }}
          wrapperCol={{ span: 16 }}
          initialValues={{ remember: true }}
          onFinish={(values) => {
            this.props.onSearch(values.keyword ? values.keyword : "")
          }}
          // onFinishFailed={onFinishFailed}
          autoComplete="off"
        >
          <Form.Item
            label="请输入关键字"
            name="keyword"
          >
            <Input placeholder="请输入关键字"/>
          </Form.Item>
          <Form.Item>
            <Button
              type="primary"
              htmlType="submit"
            >
              搜索
            </Button>
          </Form.Item>
          <Form.Item>
            <Button
              type="default"
              onClick={() => {
                this.props.onSearch("")
              }}
            >
              全部
            </Button>
          </Form.Item>
        </Form>
      </Card>
    );
  }
}

export default TableSearch;
